package com.tengju.data.infrastructure.repository.clickhouse.convert;

import com.tengju.data.domain.model.clickhouse.dashboard.DashBoardPeopleAnalysisInfo;
import com.tengju.data.infrastructure.persistence.mybatis.dataobject.DashBoardPeopleAnalysisDO;
import org.apache.commons.collections.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 
 * @Date: 2021/5/7 10:34
 * @Description: 
 */
public class DashBoardPeopleAnalysisConvert {

    public static DashBoardPeopleAnalysisInfo toModel(List<DashBoardPeopleAnalysisDO> doList) {
        DashBoardPeopleAnalysisInfo info = new DashBoardPeopleAnalysisInfo();
        if (CollectionUtils.isEmpty(doList)) {
            return info;
        }
        for (DashBoardPeopleAnalysisDO peo : doList) {
            //新人类型
            if ("new_tag".equals(peo.getType())) {
                if ("10".equals(peo.getValue())) {
                    info.setNewLowerCapacity(peo.getSize());
                }
                if ("20".equals(peo.getValue())) {
                    info.setNewMediumCapacity(peo.getSize());
                }
                if ("30".equals(peo.getValue())) {
                    info.setNewHigherCapacity(peo.getSize());
                }

            }
            //收益类型
            if ("bonus_tag".equals(peo.getType())) {
                if ("10".equals(peo.getValue())) {
                    info.setHighEarningsUp(peo.getSize());
                }
                if ("20".equals(peo.getValue())) {
                    info.setHighEarningsStab(peo.getSize());
                }
                if ("30".equals(peo.getValue())) {
                    info.setHighEarningsDown(peo.getSize());
                }

                if ("40".equals(peo.getValue())) {
                    info.setMediumEarningsUp(peo.getSize());
                }
                if ("50".equals(peo.getValue())) {
                    info.setMediumEarningsStab(peo.getSize());
                }
                if ("60".equals(peo.getValue())) {
                    info.setMediumEarningsDown(peo.getSize());
                }

                if ("70".equals(peo.getValue())) {
                    info.setLowerEarningsUp(peo.getSize());
                }
                if ("80".equals(peo.getValue())) {
                    info.setLowerEarningsStab(peo.getSize());
                }
                if ("90".equals(peo.getValue())) {
                    info.setLowerEarningsDown(peo.getSize());
                }
            }

        }
        return info;

    }

}
